package com.bbva.kyfb.kyfbjpatlbh.dominiotlbh;

import flexjson.JSONDeserializer;
import flexjson.JSONSerializer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.roo.addon.entity.RooIdentifier;

@Embeddable
@Configurable
@RooIdentifier(dbManaged = true)
public final class TtlsbefnPK implements java.io.Serializable, org.springframework.beans.factory.aspectj.ConfigurableObject {

	@Column(name = "COD_CLIECASH", nullable = false,columnDefinition = "CHAR", length = 16)
    private String codCliecash;

	@Column(name = "COD_CLASEORD", nullable = false,columnDefinition = "CHAR", length = 3)
    private String codClaseord;

	@Column(name = "COD_IDORDEN", nullable = false,columnDefinition = "CHAR", length = 8)
    private String codIdorden;

	public TtlsbefnPK(String codCliecash, String codClaseord, String codIdorden) {
        super();
        this.codCliecash = codCliecash;
        this.codClaseord = codClaseord;
        this.codIdorden = codIdorden;
    }

	@SuppressWarnings("unused")
	private TtlsbefnPK() {
        super();
    }

	public String getCodCliecash() {
        return this.codCliecash;
    }

	public String getCodClaseord() {
        return this.codClaseord;
    }

	public String getCodIdorden() {
        return this.codIdorden;
    }

	public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null) return false;
        if (!(obj instanceof TtlsbefnPK)) return false;
        TtlsbefnPK other = (TtlsbefnPK) obj;
        if (codCliecash == null) {
            if (other.codCliecash != null) return false;
        } else if (!codCliecash.equals(other.codCliecash)) return false;
        if (codClaseord == null) {
            if (other.codClaseord != null) return false;
        } else if (!codClaseord.equals(other.codClaseord)) return false;
        if (codIdorden == null) {
            if (other.codIdorden != null) return false;
        } else if (!codIdorden.equals(other.codIdorden)) return false;
        return true;
    }

	public int hashCode() {
        final int prime = 31;
        int result = 17;
        result = prime * result + (codCliecash == null ? 0 : codCliecash.hashCode());
        result = prime * result + (codClaseord == null ? 0 : codClaseord.hashCode());
        result = prime * result + (codIdorden == null ? 0 : codIdorden.hashCode());
        return result;
    }

	private static final long serialVersionUID = 1L;

	public String toJson() {
        return new JSONSerializer().exclude("*.class").serialize(this);
    }

	public static TtlsbefnPK fromJsonToTtlsbefnPK(String json) {
        return new JSONDeserializer<TtlsbefnPK>().use(null, TtlsbefnPK.class).deserialize(json);
    }

	public static String toJsonArray(Collection<TtlsbefnPK> collection) {
        return new JSONSerializer().exclude("*.class").serialize(collection);
    }

	public static Collection<TtlsbefnPK> fromJsonArrayToTtlsbefnPKs(String json) {
        return new JSONDeserializer<List<TtlsbefnPK>>().use(null, ArrayList.class).use("values", TtlsbefnPK.class).deserialize(json);
    }
}
